# -*- coding:utf-8 -*-
"""
@Author : 审心
@Time : 2023/9/28 14:58
"""
import re
from typing import List

from DrissionPage.chromium_element import ChromiumElement

from common.utils import web_page_util


def get_product_ids():
    """
    快速获取商品编号 用于测试
    执行地址 : https://s.taobao.com/search?commend=all&q=%E9%94%85&search_type=item
    :return:
    """
    p = web_page_util.create_page(is_refresh=False)
    es: List[ChromiumElement] = p.eles(".Card--doubleCardWrapper--L2XFE73")
    result = []
    for e in es:
        m = re.search(r'id=(\d+)', e.link)
        if m:
            result.append(m.group(1))
    return result


if __name__ == '__main__':
    get_product_ids()
